<!DOCTYPE html>
<html>
<head>
	<title></title>
</head>
<style>
*{margin:0;border:0;}
button{width:10%;height: 10%;}
#btn{margin-top:40px;margin-left:40px;}
/*li{list-style:none;}*/

</style>
<body>
<div>
	<button id="btn">公益.传媒</button>
	<button>态度销售</button>
	<ul id="gy">
		<li>[公益]热巴邀请你参加中法环境月</li>
		<li>[公益] 反家爆法实施一年记录</li>
		<li>[传媒] 网易携手刘国梁报道东京奥运会</li>
		<li>[传媒] 网易新闻报道国庆70周年出彩</li>
		<li>[传媒] 网易传媒以营销助理品牌增长</li>
	</ul>
</div> 

<input type="" id="input" value="请输入留言标签">
<button id="button">增加</button>
<ul id="lul">
	
</ul>

</body>
<script type="text/javascript">
function $(s) {
	return document.querySelectorAll(s);
}
var btn = $("button"),
	ul = $("#gy")[0],
	li = $("li"),
	input = $("input")[0],
	button = $("#button")[0],
	ul1 = $("#lul")[0];

btn[0].onmouseover = function(){
	btn[1].style.color = "#000";	
	btn[0].style.color = "red";
	ul.innerHTML = 
	"<li>[公益]热巴邀请你参加中法环  境月</li>"+
	"<li>[公益] 反家爆法实施一年记录</li>"+
	"<li>[传媒] 网易携手刘国梁报道东京奥运会</li>"+
	"<li>[传媒] 网易新闻报道国庆70周年出彩</li>"+
	"<li>[传媒] 网易传媒以营销助理品牌增长</li>";	
}
btn[1].onmouseover = function(){
	btn[1].style.color = "red";
	btn[0].style.color = "#000";
	ul.innerHTML=
	"<li>再创佳绩！2019 ECI Awards,网易斩获3</li>"+
	"<li>【网易态度公开课】唯一定制欧阳洗：捕</li>"+
	"<li>“瑞享生活，未来可圈”网易传媒与中国</li>"+
	"<li>搁那红毯究竟有多长？一个人拿创意节</li>"+
	"<li>[传媒] 网易传媒以营销助理品牌增长</li>";
}

// function fz(ele){
	
// 	var ul2 = ele.parentNode
// 	var i = 0;
// while(i<ele.parentNode.children){
// 	i++;
// 	console.log(ul2.indexOf(ele));
// 	console.log(ele);
// 	if (true) {}
// }
// }
// fz(li[2])
console.log()
var time = new Date;
button.onclick = function(){
	var i = ul1.children.length;
	var li1 = document.createElement("li");
	var sum=true;
	for (var j = 0; j < i; j++) {
		if (input.value == ul1.children[j].innerText) {
				sum = false;
		}
	}
		console.log(ul1)
				if (input.value.length>4&&input.value.length<21&&sum) {
				li1.innerText = input.value;
				ul1.appendChild(li1);
			}else{
			ul1.innerHTML = "<li>"+"输入格式有误"+time+"</li>";
				}
	}

function wa(ele){
	var arr=[];
var next = ele.nextElementSibling;
while(next){
	arr.push(next);
	next = next.nextElementSibling;
	}
	return arr;
}
console.log(wa(li[0]));

</script>
</html>